3 edited body
source | link

You can use the form Function[{x,y,z}, body] doto define a pure function with formal parameters x,y,z ( see Documentation >> Function)

Let

 lists = {ln125, ln126, ln127} = RandomReal[{0, 10}, {3, 10}]
 (* {{1.72286, 5.24912, 8.87257, 5.77593, 6.31276, 1.77914, 2.06393,
      0.328725, 9.46436, 4.96257}, 
     {1.71171, 2.54337, 5.93807, 9.46774,  6.99601, 2.76927, 7.58995,
      1.25785, 2.09789, 9.32326}, 
     {6.9821, 8.62002, 2.0763, 8.9402, 4.36728, 3.8571, 4.4175,
      7.15698, 7.64633, 5.23772}} *)

Define, (with 4. playing the role of 551.748 in your example):

 f2 = Function[{x}, Select[x, # == Nearest[x, 4.][[1]] &]]
 f2 /@ lists
 (* {{4.96257}, {2.76927}, {3.8571}} *)   

or

  f3 = With[{temp = Nearest[#1, 4.`][[1]]}, Select[#1, # == temp &]] &
  f3 /@ lists
  (* {{4.96257}, {2.76927}, {3.8571}} *)   

You can use the form Function[{x,y,z}, body] do define a pure function with formal parameters x,y,z ( see Documentation >> Function)

Let

 lists = {ln125, ln126, ln127} = RandomReal[{0, 10}, {3, 10}]
 (* {{1.72286, 5.24912, 8.87257, 5.77593, 6.31276, 1.77914, 2.06393,
      0.328725, 9.46436, 4.96257}, 
     {1.71171, 2.54337, 5.93807, 9.46774,  6.99601, 2.76927, 7.58995,
      1.25785, 2.09789, 9.32326}, 
     {6.9821, 8.62002, 2.0763, 8.9402, 4.36728, 3.8571, 4.4175,
      7.15698, 7.64633, 5.23772}} *)

Define, (with 4. playing the role of 551.748 in your example):

 f2 = Function[{x}, Select[x, # == Nearest[x, 4.][[1]] &]]
 f2 /@ lists
 (* {{4.96257}, {2.76927}, {3.8571}} *)   

or

  f3 = With[{temp = Nearest[#1, 4.`][[1]]}, Select[#1, # == temp &]] &
  f3 /@ lists
  (* {{4.96257}, {2.76927}, {3.8571}} *)   

You can use the form Function[{x,y,z}, body] to define a pure function with formal parameters x,y,z ( see Documentation >> Function)

Let

 lists = {ln125, ln126, ln127} = RandomReal[{0, 10}, {3, 10}]
 (* {{1.72286, 5.24912, 8.87257, 5.77593, 6.31276, 1.77914, 2.06393,
      0.328725, 9.46436, 4.96257}, 
     {1.71171, 2.54337, 5.93807, 9.46774,  6.99601, 2.76927, 7.58995,
      1.25785, 2.09789, 9.32326}, 
     {6.9821, 8.62002, 2.0763, 8.9402, 4.36728, 3.8571, 4.4175,
      7.15698, 7.64633, 5.23772}} *)

Define, (with 4. playing the role of 551.748 in your example):

 f2 = Function[{x}, Select[x, # == Nearest[x, 4.][[1]] &]]
 f2 /@ lists
 (* {{4.96257}, {2.76927}, {3.8571}} *)   

or

  f3 = With[{temp = Nearest[#1, 4.`][[1]]}, Select[#1, # == temp &]] &
  f3 /@ lists
  (* {{4.96257}, {2.76927}, {3.8571}} *)   
2 added 144 characters in body
source | link

You can use the form Function[{x,y,z}, body] do define a pure function with formal parameters x,y,z ( see Documentation >> Function)

Let

 lists = {ln125, ln126, ln127} = RandomReal[{0, 10}, {3, 10}]
 (* {{1.72286, 5.24912, 8.87257, 5.77593, 6.31276, 1.77914, 2.06393,
      0.328725, 9.46436, 4.96257}, 
     {1.71171, 2.54337, 5.93807, 9.46774,  6.99601, 2.76927, 7.58995,
      1.25785, 2.09789, 9.32326}, 
     {6.9821, 8.62002, 2.0763, 8.9402, 4.36728, 3.8571, 4.4175,
      7.15698, 7.64633, 5.23772}} *)

Define, (with 4. playing the role of 551.748 in your example):

 f2 = Function[{x}, Select[x, # == Nearest[x, 4.][[1]] &]]
 f2 /@ lists
 (* {{4.96257}, {2.76927}, {3.8571}} *)   

or

  f3 = With[{temp = Nearest[#1, 4.`][[1]]}, Select[#1, # == temp &]] &
  f3 /@ lists
  (* {{4.96257}, {2.76927}, {3.8571}} *)   

You can use the form Function[{x,y,z}, body] do define a pure function with formal parameters x,y,z ( see Documentation >> Function)

Let

 lists = {ln125, ln126, ln127} = RandomReal[{0, 10}, {3, 10}]
 (* {{1.72286, 5.24912, 8.87257, 5.77593, 6.31276, 1.77914, 2.06393,
      0.328725, 9.46436, 4.96257}, 
     {1.71171, 2.54337, 5.93807, 9.46774,  6.99601, 2.76927, 7.58995,
      1.25785, 2.09789, 9.32326}, 
     {6.9821, 8.62002, 2.0763, 8.9402, 4.36728, 3.8571, 4.4175,
      7.15698, 7.64633, 5.23772}} *)

Define, (with 4. playing the role of 551.748 in your example):

 f2 = Function[{x}, Select[x, # == Nearest[x, 4.][[1]] &]]
 f2 /@ lists
 (* {{4.96257}, {2.76927}, {3.8571}} *)   

You can use the form Function[{x,y,z}, body] do define a pure function with formal parameters x,y,z ( see Documentation >> Function)

Let

 lists = {ln125, ln126, ln127} = RandomReal[{0, 10}, {3, 10}]
 (* {{1.72286, 5.24912, 8.87257, 5.77593, 6.31276, 1.77914, 2.06393,
      0.328725, 9.46436, 4.96257}, 
     {1.71171, 2.54337, 5.93807, 9.46774,  6.99601, 2.76927, 7.58995,
      1.25785, 2.09789, 9.32326}, 
     {6.9821, 8.62002, 2.0763, 8.9402, 4.36728, 3.8571, 4.4175,
      7.15698, 7.64633, 5.23772}} *)

Define, (with 4. playing the role of 551.748 in your example):

 f2 = Function[{x}, Select[x, # == Nearest[x, 4.][[1]] &]]
 f2 /@ lists
 (* {{4.96257}, {2.76927}, {3.8571}} *)   

or

  f3 = With[{temp = Nearest[#1, 4.`][[1]]}, Select[#1, # == temp &]] &
  f3 /@ lists
  (* {{4.96257}, {2.76927}, {3.8571}} *)   
1
source | link

You can use the form Function[{x,y,z}, body] do define a pure function with formal parameters x,y,z ( see Documentation >> Function)

Let

 lists = {ln125, ln126, ln127} = RandomReal[{0, 10}, {3, 10}]
 (* {{1.72286, 5.24912, 8.87257, 5.77593, 6.31276, 1.77914, 2.06393,
      0.328725, 9.46436, 4.96257}, 
     {1.71171, 2.54337, 5.93807, 9.46774,  6.99601, 2.76927, 7.58995,
      1.25785, 2.09789, 9.32326}, 
     {6.9821, 8.62002, 2.0763, 8.9402, 4.36728, 3.8571, 4.4175,
      7.15698, 7.64633, 5.23772}} *)

Define, (with 4. playing the role of 551.748 in your example):

 f2 = Function[{x}, Select[x, # == Nearest[x, 4.][[1]] &]]
 f2 /@ lists
 (* {{4.96257}, {2.76927}, {3.8571}} *)